package com.yn.xgame;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 断言
 * Created by wangboo on 17/7/13.
 */
public class XAssert {

    private static final Logger logger = LoggerFactory.getLogger(XAssert.class);
    
    public static void nonNull(Object o, Object...print)  {
    	if (o== null) {
    		logger.error("AssertnonNull failed: {}, thread: {}", print, Thread.currentThread().getName());
            throw new AssertionError("AssertTrue failed");
		}
    }

    public static void isTrue(boolean v, Object... print) {
        if (!v) {
            logger.error("AssertTrue failed: {}, thread: {}", print, Thread.currentThread().getName());
            throw new AssertionError("AssertTrue failed");
        }
    }

    public static void isFalse(boolean v, Object... print) {
        if (v) {
            logger.error("AssertFail failed: {}, thread: {}", print, Thread.currentThread().getName());
            throw new AssertionError("AssertFail failed");
        }
    }
}
